package Aaaaaa;

import java.util.Arrays;
import java.util.Scanner;

public class Main18 {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        String str=sc.nextLine();
        String[] s=str.split(" ");
        int[] arr=new int[s.length];
        for(int i=0;i<s.length;i++){
            arr[i]=Integer.parseInt(s[i]);
        }
        int res[]=new int[arr.length];
        int left=0;
        int right=res.length-1;
        for(int i=0;i<arr.length;i++){
            if(arr[i]==1) {
                res[left++] = 1;
            }else if(arr[i]==3){
                res[right--]=3;
            }
        }
        for(int i=left;i<=right;i++){
            res[i]=2;
        }
        System.out.println(Arrays.toString(res));
    }
}
